#include<stdio.h>
int main()
{
	int arr[3] = { 0 };
	int ass[4] = { 0 };
	int sss[7] = { 0 };
	int n = 0;
	scanf_s("%d",&n);
	int b = 0;
	scanf_s("%d", &b);
	int i = 0;
	for (i = 0;i < n;i++)
	{
		scanf_s("%d",&arr[i]);

	}
	for (i = 0;i < b;i++)
	{
		scanf_s("%d", &ass[i]);
	}

	int a = 0;
	int s = 0;
	int h = 0;
	while (a < n && s < b)
	{
		if (arr[a] < ass[s])
		{
			sss[h] = arr[a];
			a++;
			h++;
		}
		else
		{
			sss[h] = ass[s];
			h++;
			s++;

		}
	}
	if (n < b)
	{
		for (;s < b;s++)
		{
			sss[h] = ass[s];
			h++;
		}
	}
	else
	{
		sss[h] = arr[a];
		h++;
	}
	for (i = 0;i < n + b;i++)
	{
		printf("%d",sss[i]);
	}
	return 0;
}